#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
ll n;
ll a[N], cnt[N];
int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++){
        scanf("%lld", &a[i]);
    }
    sort(a+1, a+1+n);
    int num = 0;
    cnt[++num] = 1;
    for(int i = 2; i <= n; i++){
        if(a[i] == a[i-1]) cnt[num]++;
        else cnt[++num] = 1;
    }
//    for(int i = 1; i <= num; i++){
//        printf("%lld\n", cnt[i]);
//    }
    ll ans = 0, res = 0;
    for(int i = 1; i <= num; i++){
        if(res < cnt[i]){
            ans += res;
            res = cnt[i];
        }
        else{
            ans += cnt[i];
        }
//        cout << ans << endl;
    }
    cout << n-ans;
    return 0;
}
/*
10
136 136 136 2417 136 136 2417 136 136 136
*/
